from student.models import Student, School, SchoolClass
from rest_framework import serializers


class StudentSerializer(serializers.HyperlinkedModelSerializer):
    class Meta:
        model = Student
        # 这里的url是restframework为我们提供的
        fields = ("url", "id", "name", "age", "gender", "birthday", "school_class")


class SchoolSerializer(serializers.HyperlinkedModelSerializer):
    class Meta:
        model = School
        fields = ("url", "id", "name")


class SchoolClassSerializer(serializers.HyperlinkedModelSerializer):
    class Meta:
        model = SchoolClass
        # 这里的url是restframework为我们提供的
        fields = ("url", "id", "name", "grade_num", "class_num", "school")
